package com.aiyige.page.publish.normalvideo.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by zhuyakun on 2017/11/8.
 */

public class PublishNormalVideoItem implements Parcelable {
    String title;
    String coverUrl;
    long duration;
    long size;
    String videoUrl;


    public PublishNormalVideoItem() {
    }

    private PublishNormalVideoItem(Builder builder) {
        setTitle(builder.title);
        setCoverUrl(builder.coverUrl);
        setDuration(builder.duration);
        setSize(builder.size);
        setVideoUrl(builder.videoUrl);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl = coverUrl;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public String getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    public static final class Builder {
        private String title;
        private String coverUrl;
        private long duration;
        private long size;
        private String videoUrl;

        private Builder() {
            title = "";
            coverUrl = "";
            duration = 0;
            size = 0;
            videoUrl = "";
        }

        public Builder title(String title) {
            this.title = title;
            return this;
        }

        public Builder coverUrl(String coverUrl) {
            this.coverUrl = coverUrl;
            return this;
        }

        public Builder duration(long duration) {
            this.duration = duration;
            return this;
        }

        public Builder size(long size) {
            this.size = size;
            return this;
        }

        public Builder videoUrl(String videoUrl) {
            this.videoUrl = videoUrl;
            return this;
        }

        public PublishNormalVideoItem build() {
            return new PublishNormalVideoItem(this);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.title);
        dest.writeString(this.coverUrl);
        dest.writeLong(this.duration);
        dest.writeLong(this.size);
        dest.writeString(this.videoUrl);
    }

    protected PublishNormalVideoItem(Parcel in) {
        this.title = in.readString();
        this.coverUrl = in.readString();
        this.duration = in.readLong();
        this.size = in.readLong();
        this.videoUrl = in.readString();
    }

    public static final Parcelable.Creator<PublishNormalVideoItem> CREATOR = new Parcelable.Creator<PublishNormalVideoItem>() {
        @Override
        public PublishNormalVideoItem createFromParcel(Parcel source) {
            return new PublishNormalVideoItem(source);
        }

        @Override
        public PublishNormalVideoItem[] newArray(int size) {
            return new PublishNormalVideoItem[size];
        }
    };
}
